home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / ogle.com / OGLE.DOC < prev    next >
Encoding:
Text File  |  1989-09-04  |  4.3 KB  |  97 lines

  1.                               OGLE
  2.                          by Michael Day
  3.                      as of 4 September 1989 
  4.  
  5.  
  6.  
  7.      There  is a song that goes "I only have eyes for you  dear." 
  8. Ogle  can be described that way. Ogle is in love with the  mouse. 
  9. In  fact,  Ogle  is so much in love that  it  watches  the  mouse 
  10. wherever it goes. 
  11.  
  12.      I originally saw this running on a Sun workstation. I  liked 
  13. it so much I decided to write a version for the PC. 
  14.  
  15.      Actually,  the EYES unit that Ogle uses can be made to  look 
  16. at any point on the screen and not just the mouse. The  procedure 
  17. "LookAt"  contains two parameters, "Mx" and "My". These  are  the 
  18. X/Y location on the screen to look at. 
  19.  
  20.  
  21.  
  22. Creating the Eyes:
  23.    
  24. procedure MakeEyes(var EyeData:EyeDataRec; 
  25.                   Xp,Yp,Size,Style:integer; Eye,Edge,Pupil:byte); 
  26.  
  27.      To  create  the Eyes, you will need to place a call  to  the 
  28. "MakeEyes"  procedure.  MakeEyes expects  eight  parameters.  The 
  29. first parameter is a record variable called EyeData. EyeData does 
  30. not need to be preinitialized to anything, the MakeEyes procedure 
  31. will  correctly configure the EyeData record based on  the  other 
  32. four  parameters that are passed. The EyeData variable can  be  a 
  33. global variable, or one that is created on the heap. 
  34.  
  35.      The  Xp/Yp parameters specify the screen position  to  place 
  36. the  eyes.  The Xp/Yp coordinate specified is the center  of  the 
  37. left  eye.  The Size parameter passed is the X radius of the  eye 
  38. ellipse. All other parameters for the eye are derived from  this. 
  39. The  Y  radius  is predefined as being twice the size  of  the  X 
  40. radius  passed.  The right eye is simply a copy of the  left  eye 
  41. offset to the right by an X radius factor of three. The Y  radius 
  42. is corrected for the proper aspect ratio on the screen.
  43.  
  44.      The  Style parameter specifies the type of eye  movement  to 
  45. use.  A value of one will cause the eye movement to  be  directly 
  46. scaled  down  from the screen. The screen is  divided  into  four 
  47. quadrants around the center of each eye. If the mouse resides  in 
  48. one of the screen quadrants, the mouse position is scaled down to 
  49. fit with the appropriate eye quadrant in a similar position.
  50.  
  51.      If  the Style parameter passed is two, then the  scaled  eye 
  52. movement will be modified with a log2 conversion. This causes the 
  53. eye  movement  to be more sensitive as the mouse comes  near  the 
  54. eye center position.
  55.  
  56.      If the Style parameter passed is anything other than one  or 
  57. two,  the eye movement will be limited. That is, as long  as  the 
  58. mouse  X or Y parameter resides within the eye boundry the  pupil 
  59. will  follow the mouse. When the mouse parameter exceeds the  eye 
  60. movement  boundry it will become limited to the edge of  the  eye 
  61. boundry for that parameter.
  62.  
  63.      The  Eye, Edge, and Pupil parameters control the eye  colors 
  64. used.  "Eye" sets the eye background color. "Edge" sets the  edge 
  65. color of the eye, and "Pupil" sets the Pupil color of the eye.
  66.  
  67.  
  68. Pointing the eyes:
  69.  
  70. procedure LookAt(var EyeData:EyeDataRec; Xp,Yp:integer);
  71.  
  72.      You can point the eyes at any screen location by calling the 
  73. LookAt  procedure.  Three  parameters are passed.  The  forst  is 
  74. the  variable parameter EyeData which points to the EyeData  that 
  75. was configured by MakeEyes. You must call the MakeEyes  procedure 
  76. at  least  once  to set up the  EyeData  before  calling  LookAt. 
  77. Failure to do so will most likely cause a program crash. 
  78.  
  79.      All  the  data needed by the LookAt procedure  is  contained 
  80. within the EyeData record. This allows you to place multiple eyes 
  81. on  the  screen  by  setting up  multiple  EyeData  records.  The 
  82. MakeEyes procedure only affects the EyeData record passed to  it. 
  83. The Ogle demo program provided shows an example of multiple  eyes 
  84. on the display.
  85.  
  86.      The position of the screen that you want the Eyes to look at 
  87. is passed in the Xp,Yp parameters. 
  88.  
  89.      You can change the eye movement style, or the eye colors, or 
  90. the  position  of  the eyes on the screen at  anytime  by  simply 
  91. calling  the MakeEye procedure again at anytime. It is up to  you 
  92. to  remove  the  old eyes from the screen first if  you  will  be 
  93. changing their position.
  94.  
  95. <eof>
  96.  
  97.